/*
 * tarm_FactorConfig.h
 *
 *  Created on: 2020年2月10日
 *      Author: AN
 */

#ifndef APPLICATION_TARM_FACTORCONFIG_H_
#define APPLICATION_TARM_FACTORCONFIG_H_

#include <stdint.h>

/************ NEW Factor value **************/
struct _TARM_FactorStruct{
	//1- limit prime(限位角度-主轴);	limit vice(限位角度-副轴)
	float limit_p, limit_v;
	//2- null vice(零点角度-主轴);		null vice(零点角度-副轴)
	float null_p, null_v;
	//3- 臂长
	float length_p, length_v;
	//4- 步进电机步长
	double step_p, step_v, step_r;
};
extern const struct _TARM_FactorStruct g_TARM_Factor;

/************ new running record value **************/
struct _TARM_PVValStruct{
	double x,y;
	double p,v;
};
struct _TARM_RValStruct{
	float d;	//distanc
	float c;	//current
};
struct _TARM_RunningRecordStruct{
	//1- PV轴运动参数
	struct _TARM_PVValStruct pv_distance,pv_start,pv_current;
	//2- R轴运动参数
	struct _TARM_RValStruct r_val;

	//3- 时钟1方案下，各轴运动进行中标志位
	uint8_t RunFlag_p, RunFlag_v, RunFlag_r;
	//4- 时钟1方案下，各轴运动时间记录
	uint8_t CounterTimer_p, CounterTimer_v, CounterTimer_r;

	//5- 时钟2方案下，速度控制参数
	double SpeedReci_MsPerCm;

	//6- 末端舵机参数
	uint32_t TurnNum, ClickNum;
};
extern struct _TARM_RunningRecordStruct g_TARM_RunRecord;

/************ running factor **************/
//report delay
#define _CloseloopDelayMsValue_ 10000

/************ report value **************/
struct _Uart_ReportStruct{
	unsigned int VerifySuccess;
	unsigned int VerifyError;

	unsigned int ExecuteFinish;

	unsigned int CloseLoop_ErrorFlag;
	unsigned int CloseLoopReport;
};
struct _Uart_SpeedDebugStruct{
	uint8_t ReportFlag;	//if report? 3- first start but no read ; 2-report finish ,first no start
						// 1- ready to report ; 0-is running
	uint32_t MinTimeForTheory;		//the mintime
	uint32_t MinTimeForReally;
	char Buffer[1000];	//report data
};
struct _ReportStruct{
	struct _Uart_ReportStruct Uart1ReportFlag;
	struct _Uart_ReportStruct Uart2ReportFlag;
	struct _Uart_SpeedDebugStruct SpeedDebugStruct;
};
extern struct _ReportStruct ReportStruct;


#endif /* APPLICATION_TARM_FACTORCONFIG_H_ */
